package com.lelefly.base.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lelefly.base.model.Result;
import com.lelefly.base.po.FarmlandAccess;
import com.lelefly.base.po.FarmlandSpray;
import com.lelefly.base.serviceImp.FarmlandAccessService;
import com.lelefly.base.serviceImp.FarmlandSprayService;

@Controller
@RequestMapping("/farminfo")
public class FarmlandSprayController extends BaseController{

	@Resource
	public FarmlandSprayService farmlandSprayService;
	
	

	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/getFarmlandSpray",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result getFarmlandSpray(String usernm){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandSprayService.getFarmlandSpray(usernm);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/addFarmlandSpray",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result addFarmlandSpray(FarmlandSpray farmlandSpray){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandSprayService.addFarmlandSpray(farmlandSpray);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	

	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@RequestMapping(value="/delFarmlandSpray",produces="application/json;charset=utf-8")
	@ResponseBody
	public Result delFarmlandAccesss(String id){
		Result<FarmlandAccess> result=null;
		try {
			result = farmlandSprayService.delFarmlandSpray(id);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			getLogger().info("----->>"+e.getLocalizedMessage());
		}
		return result;
	}
	
	
}
